2020-2021 Sunseeker Telemetry and Lighting System
lcd_c_ex1_4mux.c
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2017, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 //*****************************************************************************
67 //*****************************************************************************
68 #include "driverlib.h"
69 
70 int main(void) {
71 
72  WDT_A_hold(WDT_A_BASE);
73 
74  // Disable the GPIO power-on default high-impedance mode to activate
75  // previously configured port settings
76  PMM_unlockLPM5();
77 
78  //enable interrupts
79  __enable_interrupt();
80 
81  LCD_C_setPinAsLCDFunctionEx(LCD_C_BASE, LCD_C_SEGMENT_LINE_0, LCD_C_SEGMENT_LINE_21);
82  LCD_C_setPinAsLCDFunctionEx(LCD_C_BASE, LCD_C_SEGMENT_LINE_26, LCD_C_SEGMENT_LINE_43);
83 
84  LCD_C_initParam initParams = {0};
85  initParams.clockSource = LCD_C_CLOCKSOURCE_ACLK;
86  initParams.clockDivider = LCD_C_CLOCKDIVIDER_1;
87  initParams.clockPrescalar = LCD_C_CLOCKPRESCALAR_16;
88  initParams.muxRate = LCD_C_4_MUX;
89  initParams.waveforms = LCD_C_LOW_POWER_WAVEFORMS;
90  initParams.segments = LCD_C_SEGMENTS_ENABLED;
91 
92  LCD_C_init(LCD_C_BASE, &initParams);
93 
94  // LCD Operation - VLCD generated internally, V2-V4 generated internally, v5 to ground
95  LCD_C_setVLCDSource(LCD_C_BASE, LCD_C_VLCD_GENERATED_INTERNALLY, LCD_C_V2V3V4_GENERATED_INTERNALLY_NOT_SWITCHED_TO_PINS,
96  LCD_C_V5_VSS);
97 
98  // Set VLCD voltage to 2.60v
99  LCD_C_setVLCDVoltage(LCD_C_BASE, LCD_C_CHARGEPUMP_VOLTAGE_2_60V_OR_2_17VREF);
100 
101  // Enable charge pump and select internal reference for it
102  LCD_C_enableChargePump(LCD_C_BASE);
103  LCD_C_selectChargePumpReference(LCD_C_BASE, LCD_C_INTERNAL_REFERENCE_VOLTAGE);
104 
105  LCD_C_configChargePump(LCD_C_BASE, LCD_C_SYNCHRONIZATION_ENABLED, 0);
106 
107  // Clear LCD memory
108  LCD_C_clearMemory(LCD_C_BASE);
109 
110  // Display "123456"
111  // LCD Pin18-Pin19 for '1'
112  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_18, 0x0);
113  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_19, 0x6);
114 
115  // LCD Pin10-Pin11 for '2'
116  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_10, 0xB);
117  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_11, 0xD);
118 
119  // LCD Pin6-Pin7 for '3'
120  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_6, 0x3);
121  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_7, 0xF);
122 
123  // LCD Pin36-Pin37 for '4'
124  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_36, 0x7);
125  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_37, 0x6);
126 
127  // LCD Pin28-Pin29 for '5'
128  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_28, 0x7);
129  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_29, 0xB);
130 
131  // LCD Pin14-Pin15 for '6'
132  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_14, 0xF);
133  LCD_C_setMemory(LCD_C_BASE, LCD_C_SEGMENT_LINE_15, 0xB);
134 
135  // Turn LCD on
136  LCD_C_on(LCD_C_BASE);
137  // Set breakpoint here to see the "123456"
138  __no_operation();
139  // Prepare LCD for adding new segments to old letters to make new letters
140  LCD_C_off(LCD_C_BASE);
152  // Display "Ue9A68"
153  // LCD Pin18-Pin19 for changing '1' to 'U'
154  LCD_C_setMemoryWithoutOverwrite(LCD_C_BASE, LCD_C_SEGMENT_LINE_18, 0xC);
155  LCD_C_setMemoryWithoutOverwrite(LCD_C_BASE, LCD_C_SEGMENT_LINE_19, 0x1);
156 
157  // LCD Pin10-Pin11 for changing '2' to 'e'
158  LCD_C_setMemoryWithoutOverwrite(LCD_C_BASE, LCD_C_SEGMENT_LINE_10, 0x4);
159 
160  // LCD Pin6-Pin7 for changing '3' to '9'
161  LCD_C_setMemoryWithoutOverwrite(LCD_C_BASE, LCD_C_SEGMENT_LINE_6, 0x4);
162 
163  // LCD Pin36-Pin37 for changing '4' to 'A'
164  LCD_C_setMemoryWithoutOverwrite(LCD_C_BASE, LCD_C_SEGMENT_LINE_36, 0x8);
165  LCD_C_setMemoryWithoutOverwrite(LCD_C_BASE, LCD_C_SEGMENT_LINE_37, 0x8);
166 
167  // LCD Pin28-Pin29 for changing '5' to '6'
168  LCD_C_setMemoryWithoutOverwrite(LCD_C_BASE, LCD_C_SEGMENT_LINE_28, 0x8);
169 
170  // LCD Pin14-Pin15 for changing '6' to '8'
171  LCD_C_setMemoryWithoutOverwrite(LCD_C_BASE, LCD_C_SEGMENT_LINE_15, 0x4);
172 
173  //Turn LCD on
174  LCD_C_on(LCD_C_BASE);
175 
176  __bis_SR_register(LPM3_bits | GIE);
177 
178  return 0;
179 }
__no_operation()
int main(void)